package com.lncd.backend.dto;

import com.lncd.backend.model.Location;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class LocationDTO {
    private Long id;
    private Long userId;
    private double latitude;
    private double longitude;
    private String address;
    private Date timestamp;

    public static LocationDTO fromEntity(Location location) {
        LocationDTO dto = new LocationDTO();
        dto.setId(location.getId());
        dto.setUserId(location.getUser().getId());
        dto.setLatitude(location.getLatitude());
        dto.setLongitude(location.getLongitude());
        dto.setAddress(location.getAddress());
        dto.setTimestamp(location.getTimestamp());
        return dto;
    }
} 